<template>
  <s-modal
    title="新增"
    :visible="visible"
    width="800px"
    ok-text="保存"
    :confirm-loading="confirmLoading"
    :closable="!confirmLoading"
    @ok="save()"
    @cancel="()=>{if(!confirmLoading){ visible=false }}"
  >
    <div style="height:400px">
      <s-scroll>
        <s-form ref="form" :value="formValue">
          <s-form-item
            label="序号"
            size="middle"
            name="connectorId"
            :colon="true"
            :display-title="true"
            :rules="[{'max':255,'message':'最长为255位'}]"
          >
            <s-input
              :allow-clear="true"
              placeholder="请输入序号"
              v-model="formValue.connectorId"
              />
          </s-form-item>
          <s-form-item
            label="接口名称"
            size="middle"
            name="connectorName"
            :colon="true"
            :display-title="true"
            :rules="[{'max':255,'message':'最长为255位'}]"
          >
            <s-input
              :allow-clear="true"
              placeholder="请输入接口名称"
              v-model="formValue.connectorName"
              />
          </s-form-item>
          <s-form-item
            label="接口地址"
            size="middle"
            name="connectorAddress"
            :colon="true"
            :display-title="true"
            :rules="[{'max':255,'message':'最长为255位'}]"
          >
            <s-input
              :allow-clear="true"
              placeholder="请输入接口地址"
              v-model="formValue.connectorAddress"
              />
          </s-form-item>
          <s-form-item
            label="最近调用时间"
            size="middle"
            name="quoteTime"
            :colon="true"
            :display-title="true"
            :rules="[{'max':255,'message':'最长为255位'}]"
          >
            <s-input
              :allow-clear="true"
              placeholder="请输入最近调用时间"
              v-model="formValue.quoteTime"
              />
          </s-form-item>
          <s-form-item
            label="本月"
            size="middle"
            name="quoteNum"
            :colon="true"
            :display-title="true"
            :rules="[{'max':255,'message':'最长为255位'}]"
          >
            <s-input
              :allow-clear="true"
              placeholder="请输入本月"
              v-model="formValue.quoteNum"
              />
          </s-form-item>
          <s-form-item
            label="接口状态"
            size="middle"
            name="connectorStatus"
            :colon="true"
            :display-title="true"
            :rules="[{'max':255,'message':'最长为255位'}]"
          >
            <s-input
              :allow-clear="true"
              placeholder="请输入接口状态"
              v-model="formValue.connectorStatus"
              />
          </s-form-item>
          <s-form-item
            label="总调用次数"
            size="middle"
            name="quoteTotalNum"
            :colon="true"
            :display-title="true"
            :rules="[{'max':255,'message':'最长为255位'}]"
          >
            <s-input
              :allow-clear="true"
              placeholder="请输入总调用次数"
              v-model="formValue.quoteTotalNum"
              />
          </s-form-item>

        </s-form>
      </s-scroll>
    </div>
  </s-modal>
</template>

<script>

export default {
  name: 'Add',
  emits: ['change'],
  data() {
    return {
      formValue: {},
      confirmLoading: false,
      visible: false
    }
  },
  methods: {
    open() {
      this.formValue = {}
      this.visible = true
    },
    save() {
	  const _this=this
      const form = this.$refs.form
      form.validate((values,fullValue) => {
		
        this.confirmLoading = true
        this.$api.PUT('/modules/operateConLog/insert', values).then(res => {
          this.confirmLoading = false
          this.visible = false
          this.$emit('success');
          this.$message.info(res.msg)
        }).catch(() => {
          this.confirmLoading = false
        })
      })
    }
  }
}
</script>

<style lang="less" scoped>

</style>